home *** CD-ROM | disk | FTP | other *** search
/ How to Get Online 1996 Spring / HOW2GON.ISO / mac / Servers & CGI / GIFserv 1.0 / Release Notes < prev   
Text File  |  1995-03-24  |  4KB  |  71 lines

  1.  
  2.  
  3.  
  4.  
  5. GIFserv.acgi 1.0
  6. © 1995, Richard C. Cardona, rickc@i-link.net
  7. Released: Fri, Mar 24, 1995
  8. Requires: MacHTTP 2.0
  9. Runs on 68000-based Macs and is accelerated for PowerMacintosh
  10.  
  11. Background
  12. Netscape Communications's Netscape 1.1b1 web browser supports the capability to draw "animated" graphics from gif files.  Their demo page has a simple example of their Mozilla character rising from the horizon and breathing fire.  I wanted to support this similar animation from MacHTTP (soon be WebSTAR, I think.)  I took John O'Fallon's shell for building CGIs and the ANSI C code Netscape provided and I made GIFserv.
  13.  
  14. Purpose
  15. GIFserv receives, from a direct argument in HTTP, a folder to scan for GIF files. It doesn't care about filenames, but the file types must be Macintosh GIF (type=GIFf). It will open the files alphabetically, read their contents and formulates one large AppleEvent that contains the appropriate MIME headers for multipart/x-mixed-replace.
  16.  
  17. How to Use
  18. So what does the HTTP look like?  Simple.
  19.  
  20. It's a simple variation of <img src="My Gif File">
  21.  
  22. The syntax is:
  23. <img src="GIFserv.acgi$folder">
  24.  
  25. where folder is in the same directory with the GIFserv application.  GIFserv will not recurse folders, it will only read in all the GIF files on the top level of the folder specified.
  26.  
  27. But if you are concerned with filling your HTTP directory with folders, GIFserv does support Macintosh relative pathnames like ":folder:subfolder"
  28.  
  29. I have included an example that duplicates the functionality of the Netscape Mozilla animation so you can quickly get an idea of how this works.  Enjoy.
  30.  
  31. Performance Note/Side Effects
  32. GIFserv is designed to run as fast as possible, running accelerated for the PowerMac and using the asynchronous common gateway interface.  In doing so, it keeps the information for the last folder read in memory in case it is asked for repeatedly.  If you change the contents of a folder and GIFserv does not reflect that change, quit it and restart it or ask for a different folder so that previous contents are dumped and re-read when you select the changed folder again.
  33.  
  34. Cost
  35. This copyrighted work is free, but I retain all rights associated with it.  This is a derivative work based on John O'Fallon's Responder.  I have tested GIFserv with MacHTTP 2.0.1 and -tm versions and believe it is "error-free", but I do not give technical support for GIFserv. Use at your own risk.  It may be distributed on online services, BBSs, CDs, etc.  If you do something interesting with it, send me some mail.
  36.  
  37. Additional Info
  38. From the Netscape 1.1b1 demo page they give you the ANSI C source code for combining multiple GIFs into the result of the CGI with a multipart MIME header:
  39.  
  40. Content-type: multipart/mixed; boundary=ThisRandomString
  41.  
  42. --ThisRandomString
  43. Content-type: text/plain
  44.  
  45. Data for the first object.
  46.  
  47. --ThisRandomString
  48. Content-type: text/plain
  49.  
  50. Data for the second and last object.
  51.  
  52. --ThisRandomString--
  53.  
  54. ----------------------------------------
  55.  
  56. The above message contains two data blocks, both of type "text/plain". The
  57. final two dashes after the last occurrence of "ThisRandomString" indicate that
  58. the message is over; there is no more data.
  59.  
  60. For server push we use a variant of "multipart/mixed" called
  61. "multipart/x-mixed-replace". The "x-" indicates this type is experimental. The
  62. "replace" indicates that each new data block will cause the previous data block
  63. to be replaced -- that is, new data will be displayed instead of (not in
  64. addition to) old data.
  65.  
  66. I form the the boundaries with the name string, but the Content-type is image/gif
  67. instead of text.  The headers are actually in the STR# ID=128 resource.  I compute
  68. the content-length after I read the GIF files and replace the spaces I have as
  69. placeholders with the actual size.
  70. --
  71. Version 1.0 developed with Metrowerks CodeWarrior Academic Gold 5.5